<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品列表">
</@frame.head>
 
<script type="text/javascript" src="${contextPath}/resources/lib/jquery/1.9.1/jquery.js"></script>
 
    <div class="zp_pop" style="padding: 2px;">
        <table class="table table-border table-bordered table-bg">
 
            <tr class="text-c">
                <td colspan="3" style="text-align: left;">
                 	 商品信息
                </td>
            </tr>
            <tr>
                <td>
                    <input type="hidden" id="daiorderNo" value="${order.id?c }" />
                    	订单编号：${order.id?c}
                </td>
                <td >
                  	  订单时间：${order.orderTime?date} 
                </td>
            </tr>
            <tr>
                <td colspan="2">
                <table width="100%" class="table table-border table-bordered table-bg" border="0" cellspacing="1" bordercolor="black">
                    <tr>
                        <td><b>商品名称</b></td><td><b>单价</b></td><td><b>数量</b></td><td><b>小计</b></td>
                    </tr>
                
                    <#list  detailList as d  >
                    <tr>
                        <td width="300px;">${d.product.baseInfo.name }</td>
                        <td>
                            <s:if test="#d.buyType==1">
                                ${d.mileages }里程
                            </s:if>
                        </td>
                        <td>${d.buyNum }</td>
                        <td>
                            <#if   d.buyType==1 >
                                ${d.mileages *d.buyNum}里程
                            </#if>
                        </td>
                    </tr>
                    
                </#list>
                </table>
                </td>
            </tr>
            
            <tr>
                <td colspan="3">
                    <div id="detailone"></div>
                 	   配送信息 
                </td>
            </tr>
        <#if   order.orderType==2 >
        <input type="hidden" id="orderType" name="orderType"  value="${order.orderType}" />
                             <tr>
 
                <td colspan="2">
        
             接收电子码手机号：<input id="xn_phone" name="xn_phone" type="text" size="20" class="input-text size-M" value="${order.xn_phone}" style="width: 150px;"/><br/>
        
                        </td>
            </tr>
     
         <#else>
                     <tr>
 
                <td colspan="2">
 
                    收货地址：${order.receiveInfo.provCityArea }${order.receiveInfo.recAddress }
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    收货人：${order.receiveInfo.recName } 
                    <#if order.receiveInfo.recMobil!=null >手机：${order.receiveInfo.recMobil }</#if>
                    <#if  order.receiveInfo.recPhone!=null >电话：${order.receiveInfo.recPhone }</#if>
                    邮编:${order.receiveInfo.recPostno }
                </td>
 
            </tr>
             </#if>
 
            <tr>
                <td colspan="2">
                    其他信息：
                    
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    备注：${order.remark }
                </td>
            </tr>
            <tr>
                <td align="center">
                <input type="text" id="insuredMoney" name="insuredMoney" disabled="disabled" style="display:none">
                <input class="insuredchang" name="insured" hidden="hidden" checked="checked" value="1" id="isfalse" type="radio">
                <#if  order.orderType != 3  >
                    <input type="button" class="btn btn-success radius" value="发货" onclick="sendMessage5(5)">
                </#if>
                </td>
                <td align="center">
                    <input type="button" class="btn btn-success radius" value="信息不正确" onclick="updateTbState(3)">
                    <input type="button"  class="btn btn-success radius" value="订单异常" onclick="operateMonitor()"/>
                </td>
            </tr>
        </table>     
         
    </div>
<@frame.end "default">
</@frame.end>
<script>
 
function commitOrder(state){
var id=$("#orderNo").val();    
var path="${contextPath}";
var remark=$("#remark").val();
$.ajax({
    url : path + "/tbOrder/update_order_state",
    cache : false,
    type : 'post',
    dataType : 'text',
    data : {
        "id" : id,
        "state" : state,
        "remark" : remark
    },
    success : function(msg) {
        layer.msg('操作成功!',{icon:1,time:1000},function(){
            var index = parent.layer.getFrameIndex(window.name);
            parent.$("#query_order").submit();
            parent.layer.close(index);
        });
     
    },
    error : function() {
        layer.msg('操作失败!',{icon:1,time:1000},function(){
        });
        
    }
});    
}
 
 
 
function sendMessage5(state){
 
var id=$("#orderNo").val();    
var path="${contextPath}";
var oid = $("#daiorderNo").val();
var otype = $("#orderType").val();
if(otype!=2){
    layer.confirm("是否选择不保价操作？",function(){
        var url=path+"/tbOrder/send_order";
        $.ajax({
            url:url,
            type:"post",
            data:{id:oid,insuredMoney:"",insured:1},
            dataType:"text",
            success:function(msg){
                layer.msg("进销存-"+msg,{icon:1,time:1000},function(){
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.$("#query_order").submit();
                    parent.layer.close(index);
                });
            },
            error: function(){
                layer.msg('操作失败!',{icon:1,time:1000},function(){
                });
            }
        }); 
        
        
    });
    
    return; 
 } 
 //下面是发送短信 订单状态为2的
$.ajax({
    url : path + "/tbOrder/send_message",
    cache : false,
    type : 'post',
    dataType : 'text',
    data : {
        "orderId" : oid,
        "notSentorder" : oid 
     
    },
    success : function(msg) {
        layer.msg('操作成功!',{icon:1,time:1000},function(){
            var index = parent.layer.getFrameIndex(window.name);
            parent.$("#query_order").submit();
            parent.layer.close(index);
        });
     
    },
    error : function() {
        layer.msg('操作失败!',{icon:1,time:1000},function(){
        });
        
    }
});    
} 
 
function updateTbState(state){
    var id = $("#daiorderNo").val();
     
    var path="${contextPath}";
    var remark=$("#remark").val();
    $.ajax({
        url : path + "/tbOrder/update_order_state",
        cache : false,
        type : 'post',
        dataType : 'text',
        data : {
            "id" : id,
            "state" : state 
        },
        success : function(msg) {
            layer.msg('操作成功!',{icon:1,time:1000},function(){
                var index = parent.layer.getFrameIndex(window.name);
                parent.$("#query_order").submit();
                parent.layer.close(index);
            });
         
        },
        error : function() {
            layer.msg('操作失败!',{icon:1,time:1000},function(){
            });
            
        }
    });    
    
}
 
 
function operateMonitor(){
    var id = $("#daiorderNo").val();
    var path="${contextPath}";
    $.ajax({
        url : path + "/tbOrder/operate_monitor_order",
        cache : false,
        type : 'post',
        dataType : 'text',
        data : {
            "orderId" : id 
        },
        success : function(msg) {
            layer.msg('操作成功!',{icon:1,time:1500},function(){
                var index = parent.layer.getFrameIndex(window.name);
                parent.$("#query_order").submit();
                parent.layer.close(index);
                
            });
         
        },
        error : function() {
            layer.msg('操作失败!',{icon:1,time:1000},function(){
            });
            
        }
    });    
    
}
function goToqueryOrder(){
    //self.location.href="/shopAdmin/tbOrder/query_tbOrderPage?state=2";
}
</script>
 
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/order/search_order_list.js"></script>
 